Skip to content

✨[Feat] Sprint 2 JPEG Container Parser - #3

Merged
maruson08 merged 4 commits into
mainfrom
feat/sprint-2-jpeg-container-parser
Aug 24, 2026
Merged

✨[Feat] Sprint 2 JPEG Container Parser#3
maruson08 merged 4 commits into
mainfrom
feat/sprint-2-jpeg-container-parser

Conversation

@maruson08

Copy link
Copy Markdown
Member

Summary

  • add iterative bounded JPEG marker traversal with centralized marker semantics
  • validate SOI, two-byte big-endian segment lengths, complete declared ranges, EOI, and maxSegments
  • handle repeated FF fill bytes and standalone SOI/EOI/TEM/RST0-RST7 markers
  • skip entropy-coded scan bytes without decoding, preserving FF 00 stuffing and restart-marker behavior
  • resume after real scan markers to support multiple SOS scans
  • classify APP0-APP15 and COM using payload-bounded signatures
  • detect EXIF, standard and extended XMP, ICC, Photoshop/IPTC, JFIF/JFXX, Adobe, and unknown APP payloads
  • integrate normalized container entries and complete/partial JPEG status into inspectMetadata

Diagnostics

JPEG_INVALID_SOI, JPEG_INVALID_MARKER, JPEG_TRUNCATED_MARKER, JPEG_TRUNCATED_SEGMENT_LENGTH, JPEG_INVALID_SEGMENT_LENGTH, JPEG_TRUNCATED_SEGMENT, JPEG_TRUNCATED_SCAN, JPEG_MISSING_EOI, JPEG_SEGMENT_LIMIT_EXCEEDED, and JPEG_TRAILING_DATA.

Tests

  • 10 test files, 110 tests passed
  • declared lengths 0, 1, 2, 3, normal, missing, and truncated
  • fill bytes, byte stuffing, restart markers, scan truncation, and multiple scans
  • APP/COM known and unknown classification, including cross-segment signature prevention
  • segment limits, subviews, determinism, input preservation, and malformed marker syntax

Deferred

No TIFF/EXIF/GPS field decoding, XMP XML parsing, IPTC/ICC reconstruction, thumbnail or image decoding, entropy/Huffman decoding, JPEG rewriting or cleaning, PNG/WebP parsing, fuzzing, Rust, or WASM is included.

Validation

  • npm run format:check — passed
  • npm run lint — passed
  • npm run typecheck — passed
  • npm test — 10 files, 110 tests passed
  • npm run build — ESM, source map, and declarations built
  • npm audit — 0 vulnerabilities
  • npm ls --omit=dev --depth=0 — 0 runtime dependencies
  • npm pack --dry-run — expected 7-file, 15.8 kB package payload

Security review

All JPEG reads use ByteReader. Declared lengths are fully range-checked before subtraction or offset addition. Every parser loop advances or returns. APP signatures are constrained to payload boundaries, scan data is not copied or decoded, inputs are not mutated, and no runtime network, filesystem, DOM, or Node dependency is introduced.

@maruson08
maruson08 merged commit b789d06 into main Aug 24, 2026
1 check passed
@maruson08
maruson08 deleted the feat/sprint-2-jpeg-container-parser branch August 24, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant